import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
import {UploadTypeEnum} from "@/components/Form/src/jeecg/components/JUpload";
//列表数据
export const columns: BasicColumn[] = [

  {
    title: '设备型号',
    align:"center",
    dataIndex: 'proModel_dictText',
  },
   {
    title: '负责人',
    align:"center",
     dataIndex: 'person_dictText',
   },
   {
    title: 'zip文件',
    align:"center",
    dataIndex: 'encloZip',
     customRender: render.renderTip,
   },
  {
    title: '图片',
    dataIndex: 'encloImg',
    width: 120,
    customRender: render.renderImage,
  },

   {
    title: '状态',
    align:"center",
    dataIndex: 'status'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },

  {
    title: '备注图片',
    dataIndex: 'remarkImg',
    width: 120,
    customRender: render.renderImage,
  },


   {
    title: '原因',
    align:"center",
    dataIndex: 'cause'
   },
   {
    title: '版本',
    align:"center",
    dataIndex: 'version'
   },
   {
    title: '上级ID',
    align:"center",
    dataIndex: 'supId'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "创建日期",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
	{
      label: "机型",
      field: 'proModel',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "负责人",
      field: 'person',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "状态",
      field: 'status',
      component: 'Input',
      //colProps: {span: 6},
 	},
  {
    label: "原因",
    field: "cause",
    component: 'JInput',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    field: 'proModel',
    component: 'JCategorySelect',
    label: '设备型号',
    componentProps: {
      pcode: 'A01',
      multiple: true
    }
  },
  {
    label: '负责人',
    field: 'person',
    component: 'UserSelect',
    componentProps: {
      rowKey: 'username',
      labelKey: 'realname',
      maxSelectCount: 10,
    },
  },

  {
    field: 'encloZip',
    component: 'JUpload',
    helpMessage: '无限制上传',
    label: 'zip文件',
  },

  {
    field: 'encloImg',
    component: 'JUpload',
    label: '上传图片',
    helpMessage: '上传图片',
    componentProps: {
      fileType: UploadTypeEnum.image,

    },
  },

  {
    label: '状态',
    field: 'status',
    component: 'RadioGroup',
    componentProps: {
      //options里面由一个一个的radio组成,支持disabled
      options: [
        { label: '已废弃', value: '已废弃' },
        { label: '使用中', value: '使用中' },
      ],
    },
    colProps: { span: 4 },
  },

  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    field: 'remarkImg',
    component: 'JUpload',
    label: '备注图片',
    helpMessage: '备注图片',
    componentProps: {
      fileType: UploadTypeEnum.image,

    },
  },

  {
    label: '原因',
    field: 'cause',
    component: 'Input',
  },
  {
    label: '版本',
    field: 'version',
    component: 'Input',
    show: false
  },
  {
    label: '上级ID',
    field: 'supId',
    component: 'Input',
    show: false
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  proModel: {title: '机型',order: 1,view: 'text', type: 'string',},
  person: {title: '负责人',order: 2,view: 'text', type: 'string',},
  encloZip: {title: 'zip文件',order: 3,view: 'text', type: 'string',},
  encloImg: {title: '图片',order: 4,view: 'text', type: 'string',},
  status: {title: '状态',order: 5,view: 'text', type: 'string',},
  remark: {title: '备注',order: 6,view: 'text', type: 'string',},
  remarkImg: {title: '备注图片',order: 7,view: 'text', type: 'string',},
  cause: {title: '原因',order: 8,view: 'text', type: 'string',},
  version: {title: '版本',order: 9,view: 'text', type: 'string',},
  supId: {title: '上级ID',order: 10,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
